﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ch03_1
{
    class Class7
    {
        static void Main(string[] args)
        {
            int year, month, day = 0;

            //输入年月，显示该年该月有多少天
            Console.Write("年份：");
            year = int.Parse(Console.ReadLine());
            do
            {
                Console.Write("月份：");
                month = int.Parse(Console.ReadLine());

            } while(month < 1 || month > 12);
            
            switch (month)
            {
                case 2: day = year%4==0&&year%100!=0||year%400==0? 29 : 28;break;
                case 4:
                case 6:
                case 9:
                case 11: day = 30; break;
                default: day = 31; break;
            }
            Console.WriteLine("{0}年{1}月总共有{2}天", year, month, day);
        }
    }
}
